/**
* Created by yyr on 2018/1/12
*已设立基金编辑选项卡基金详细》基金账户信息
*/
<template>
    <div>
        <div class="ca-p-22 ca-box ca-m-t-15">
            <el-row>
                <el-col :span="12" class="ca-title">
                    <h3>基金账户信息</h3>
                </el-col>
                <el-col :span='12' class="ca-align-right">
                    <div>
                        <el-button type="primary" @click="saveFundAccount()" size="medium">保存</el-button>
                        <el-button  @click="cancel()" size="medium">取消</el-button>
                    </div>
                </el-col>
            </el-row>
            <table class="ca-table ca-m-t-15" cellpadding="0" cellspacing="0">
                <tr>
                    <th width="16%" style="background:#ececec"></th>
                    <th width="28%">开户行名称</th>
                    <th width="28%">户名</th>
                    <th width="28%">账号</th>
                </tr>
                <tr v-for="(row,index) in accountList" :key="index">
                    <td style="background:#ececec">{{row.type | getNameById('account')}}</td>
                    <td><el-input :maxlength="40" v-model="row.nameOfBank"  placeholder="请输入内容"></el-input></td>
                    <td><el-input :maxlength="40" v-model="row.name"  placeholder="请输入内容"></el-input></td>
                    <td><el-input :maxlength="22" v-model="row.accountNumber"  placeholder="请输入内容"></el-input></td>
                </tr>
            </table>
        </div>
    </div>
</template>

<script type="text/ecmascript-6">
    import {api} from '../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp'
    export default {
        data() {
            return {
                itemId: this.$route.params.fundId,
                accountList: [],
            }
        },
        props: {
        },
        created() {
            this.getAccountList();
        },
        methods: {
            //获取详情
            getAccountList() {
                apiHttp(api.GET_ACCOUNT_LIST,{id: this.itemId}).then( ret=>{
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.accountList = ret.data;
                    }
                })
            },
            cancel() {
                this.$emit('idEdit',false);
            },
            saveFundAccount() {
                //先保存在关闭
                apiHttp(api.CHANGE_ACCOUNT,this.accountList).then( ret=>{
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.$message({
                            message: '操作成功',
                            type: 'success',
                            center: true
                        });
                        this.$emit('addRedDot')
                        this.cancel();
                    }
                })
            }
        },
        components: {
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
table td{
    padding: 5px 5px;
    box-sizing: border-box;
}
</style>
